package flc.ast.utils;

import com.blankj.utilcode.util.GsonUtils;
import com.blankj.utilcode.util.SPUtils;
import com.google.gson.reflect.TypeToken;

import java.util.List;

import flc.ast.bean.TransferRecordBean;


public class AppSpUtils {
    private static final String SP_NAME = "appCollSp";
    private static final SPUtils sSpUtils = SPUtils.getInstance(SP_NAME);

    public static void saveTransferRecordList(List<TransferRecordBean> list) {
        String json = GsonUtils.toJson(list);
        sSpUtils.put(Key.key_transfer_record_list, json);
    }

    public static List<TransferRecordBean> getTransferRecordList() {
        String json = sSpUtils.getString(Key.key_transfer_record_list);
        return GsonUtils.fromJson(json, new TypeToken<List<TransferRecordBean>>() {
        }.getType());
    }

    public static void saveReceiveRecordList(List<TransferRecordBean> list) {
        String json = GsonUtils.toJson(list);
        sSpUtils.put(Key.key_receive_record_list, json);
    }

    public static List<TransferRecordBean> getReceiveRecordList() {
        String json = sSpUtils.getString(Key.key_receive_record_list);
        return GsonUtils.fromJson(json, new TypeToken<List<TransferRecordBean>>() {
        }.getType());
    }

    interface Key {
        String key_transfer_record_list = "key_transfer_record_list";
        String key_receive_record_list = "key_receive_record_list";


    }
}